package com.example.cpms.mapper;

import com.example.cpms.entity.HouseHold;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface HouseHoldMapper {

    /**
     * 查询全部建筑(弃用)
     * @return
     */
//    @Select("select * from houseHold")
//    List<HouseHold> list();

    /**
     * 根据id删除部门
     * @param id
     */
    @Delete("delete from houseHold where id = #{id}")
    void deleteById(Integer id);

    /**
     * 新增楼宇
     * @param houseHold
     */
    @Insert("insert into houseHold(name,sex,idCart,nationality,phone,mail,num,birth,buildName) values(#{name},#{sex},#{idCart},#{nationality},#{phone},#{mail},#{num},#{birth},#{buildName})")
    void insert(HouseHold houseHold);

    /**
     * 编辑楼宇
     * @param houseHold
     */
    @Update("update houseHold set name = #{name}, sex = #{sex}, idCart = #{idCart}, nationality = #{nationality}, phone = #{phone}, mail = #{mail}, num = #{num}, birth = #{birth}, buildName = #{buildName} where id = #{id} ")
    void update(HouseHold houseHold);

//    @Select("select * from houseHold")
    public List<HouseHold> list(@Param("name") String name,@Param("idCart") String idCart,@Param("phone") String phone);


}
